#include <gtest/gtest.h>

#include "test_data.h"
#include "fastcdr/Cdr.h"

using namespace eprosima::fastcdr;

TEST(TestSerialize, Serialize) {
	FastBuffer buffer;
	Cdr cdr(buffer);

	test::Test test;
	test.data({ '1','2','3','4','5','6' });
	test.head().name("usesr1");
	test.head().type(test::kText);

	test.serialize(cdr);

	size_t len = cdr.serializedLength();
	char* data = cdr.getBufferPointer();


	FastBuffer de_buffer(data,len);
	Cdr dcdr(de_buffer);
	test::Test test2;
	test2.deserialize(dcdr);

	EXPECT_EQ(test.data(), test2.data());
	EXPECT_EQ(test.head().name(), test2.head().name());

	int ddd = 0;
}









